package com.wangjie.extendsdemo;

public class FieldNameSameSeparate {
    public static void main(String[] args) {
        Zi zi = new Zi();
        zi.out();
        zi.method2();
    }
}

class Fu{
    int num = 10;
    public void method(){
        System.out.println("fu method");
    }
    public Fu(int num){
        System.out.println("fu constructor with num");
    }

    public Fu(){
        System.out.println("fu constructor");
    }
}

class Zi extends Fu{
    int num = 20;
    public Zi(){
        /*子类构造默认会调用父类构造*/
        super();
        System.out.println("zi constructor");
    }
    public void out(){
        int num = 30;
        System.out.println(num);
        System.out.println(this.num);
        System.out.println(super.num);
    }
    public void method2(){
        System.out.println("zi method");
    }
}
